package com.qf.ssm.controller.advice;

import com.qf.ssm.dto.R;
import com.qf.ssm.exceptions.MybaseException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class MyControllerAdvice {
    /**
     * 处理自定义异常的处理器
     * @param mybaseException
     * @return
     */
    @ExceptionHandler(MybaseException.class)
    public R  processMyBaseException(MybaseException mybaseException){
        return R.getResult(mybaseException.getCode(),mybaseException.getMessage());
    }

}
